﻿using SlimMath;

namespace JamesZhao.Engine.Graphics
{
    public class Lens
    {
        public float Far { get; set; }
        public float Near { get; set; }
        public float AspectRatio { get; set; }
        public float FieldOfView { get; set; }

        public Matrix ProjectionMatrix
        {
            get { return Matrix.PerspectiveFovLH(FieldOfView, AspectRatio, Near, Far); }
        }
    }

    public class Camera
    {
        public Camera()
        {
            Lens = new Lens();
        }

        public Matrix ViewMatrix
        {
            get { return Matrix.LookAtLH(Position, Position + Forward, Up); }
        }

        public Vector3 Position { get; set; }
        public Vector3 Forward { get; set; }
        public Vector3 Up { get; set; }

        public Matrix ViewProjectionMatrix
        {
            get { return ViewMatrix*Lens.ProjectionMatrix; }
        }

        public Lens Lens { get; private set; }
    }

    public enum Attenuation
    {
        None,
        Linear, //value = intensity / distance
        Quadratic // value = intensity / distance ^ 2
    }
}